﻿@model Products.Product
@{
    var dataBaseObjec = ViewData["dataBaseObject"] as Products.Databases.DatabaseObject;
    var selectVersion = ViewData["selectedVersion"] as Products.ProductVersion;
    if (selectVersion == null && dataBaseObjec != null)
    {
        selectVersion = dataBaseObjec.SwitchedVersion;
    }
    var versionList = dataBaseObjec != null ? this.Model.GetVersions(dataBaseObjec) : this.Model.Versions;   
}
<label>
    version:</label>
<select id="Versions" name="version" onchange="location=$(this).val()">
    @foreach (Products.ProductVersion v in versionList)
    {
        if (selectVersion != null && selectVersion.Id == v.Id)
        {
        <option value="@v.Name" selected="selected">@v.Name</option>                 
        }
        else
        {     
        <option value="@v.Name">@v.Name</option>                 
        }
    }
</select>
